import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },

  // 解决跨域问题
  server: {
    proxy: {
      "/api": {
        target: "http://172.17.7.240:31240/api/",
        changeOrigin: true,
        rewrite: (path: string) => {
          return path.replace(/^\/api/, "");
        },
      },
    },
  },
});
